from config import app
from flask_mail import Mail,Message

app.config['MAIL_SERVER'] = 'smtp.gmail.com'
app.config['MAIL_PORT'] = '25'
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_DEFAULT_SENDER'] = 'miku'
app.config['MAIL_USERNAME'] = 'kcilcarus@gmail.com'
app.config['MAIL_PASSWORD'] = 'K37913kong.!'

mail = Mail(app)

def send_mail(website, product, url):
    msg = Message("Hello",
        sender=app.config['MAIL_DEFAULT_SENDER'],
        recipients=["731236237@qq.com"])
    with app.app_context():
        msg.body = '{}: {} , url: {}'.format(website, product, url)
        mail.send(msg)
